<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
     <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
     <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<c:choose>
	<c:when test="${param.category=='practice' }">
		<h3><b>습작 갤러리</b></h3>
	</c:when>
	<c:when test="${param.category=='series' }">
		<h3><b>연작 갤러리</b></h3>
	</c:when>
	<c:otherwise>
		<h3><b>작품 갤러리</b></h3>
	</c:otherwise>
</c:choose>
<c:set var="list" value="${requestScope.gvo.list }"></c:set>

<div id="gallery_list">
	<c:forEach var="i" step="3" begin="0" end="${requestScope.gvo.listSize }">
	<div class="gallery_row">
		<c:forEach var="j" begin="${i }" end="${i+2 }" step="1">
		<c:if test="${j<requestScope.gvo.listSize }">
		<span class="gallery_col">
			<!--------------		추천관련 시작		-------------->		
			<c:choose>
				 <c:when test="${sessionScope.mvo.uId!=null }">
				 <!-- 로그인 사용자의 uid를 gal controller content로 넘김 -->
					<a href="gallery.do?mode=content&no=${list[j].no }&memberVO.uId=${sessionScope.mvo.uId}">
					<img src="/img/thumb_gal/${list[j].thumbImgName}"></a>
				</c:when>		
			 	<c:otherwise>
			 	<!-- 비로그인한 사용자의 uid를 0으로 셋팅하여 넘김 -->				
	 				<a href="gallery.do?mode=content&no=${list[j].no }&memberVO.uId=0">
	 				<img src="/img/thumb_gal/${list[j].thumbImgName}"></a>
				 </c:otherwise>
			 </c:choose>
			<!--------------		추천관련 끝		-------------->
			 <br><br>
			 	<!-- 댓글이 있으면 when 수행 없으면 otherwise 수행  -->		
			<c:choose>
				<c:when test="${list[j].re_count!=null}">
					<td>
						제목 : ${list[j].title }
						<font size="1" face="나눔 고딕"> [ ${list[j].re_count} ]</font><br>
					</td>
				</c:when>
				
				<c:otherwise>
					제목 : ${list[j].title }<br>
				</c:otherwise>
			</c:choose>
		<!-- 댓글관련 끝 -->	
			조회수 : ${list[j].count }  추천수 : ${list[j].wow }  작성일 : ${list[j].w_date }<br><br>
		</span>
		</c:if>
		</c:forEach>
	</div>
	</c:forEach>
</div>
<div id="gallery_paging">
<c:set var="pb" value="${requestScope.gvo.pagingBean }"></c:set>
<c:if test="${pb.previousPageGroup }">
		<a href="gallery.do?mode=list&category=${param.category }&page=${pb.startPageOfPageGroup-1 }">
		<img src="${initParam.root }/img/left_arrow_btn.gif">
		</a>
		</c:if>	

	<c:forEach var="ppg" begin="${pb.startPageOfPageGroup}"	end="${pb.endPageOfPageGroup}" step="1">
	 <c:choose>
	 	<c:when test="${pb.nowPage!=ppg}">
	 		<a href="gallery.do?mode=list&category=${param.category}&page=${ppg}">${ppg }</a>
	 	</c:when>
	    <c:otherwise>
		   ${ppg}
	    </c:otherwise>
     </c:choose>
	</c:forEach>	 

<c:if test="${pb.nextPageGroup }">
												<!-- 다음 그룹의 시작페이지 -->
<a href="gallery.do?mode=list&category=${param.category}&page=${pb.endPageOfPageGroup+1 }">
<img src="${initParam.root }/img/right_arrow_btn.gif"></a>
</c:if>
</div>